Add Tool configuration file path as a flag#11
Conversation
Codacy's Analysis Summary0 new issue (≤ 1 medium issue) Review Pull Request in Codacy →
|
There was a problem hiding this comment.
Pull Request Overview
The PR introduces a new tool_config_path input to allow custom tool configurations. While the metadata and documentation are well-updated, the implementation in action.yml contains a fragile shell command that will fail if the destination directory does not exist. This needs to be addressed to ensure the action is reliable across different repository setups.
Test plan proposal
- Verify that the action succeeds when
tool_config_pathis provided and points to a valid file in the repository root - Verify that the action succeeds when
tool_config_pathis not provided (default behavior remains intact) - Verify the action behavior when the
.codacy/tools-configs/directory does not exist before the run - Verify that the tool used for analysis (e.g., eslint) correctly picks up the settings from the moved configuration file
- Verify the behavior when
tool_config_pathpoints to a file that does not exist
About this PR
- Please provide a brief description of the PR. It's helpful to explain that this flag works by moving the configuration file to the
.codacy/tools-configs/directory, which is where the CLI expects tool-specific configurations.
💡 Codacy uses AI. Check for mistakes.
| /tmp/codacy-cli-v2 init --api-token ${{inputs.api_token}} --provider ${{inputs.provider}} --organization ${{inputs.owner}} --repository ${{inputs.repository}} | ||
| fi | ||
| if [ "${{ inputs.tool_config_path }}" != "" ]; then | ||
| mv "${{ inputs.tool_config_path }}" ./.codacy/tools-configs/ |
There was a problem hiding this comment.
🔴 HIGH RISK
The move operation assumes the destination directory ./.codacy/tools-configs/ already exists. In most fresh checkouts, this directory will be missing, causing the mv command to fail and the entire action to crash.
This might be a simple fix:
| mv "${{ inputs.tool_config_path }}" ./.codacy/tools-configs/ | |
| mkdir -p ./.codacy/tools-configs/ && mv "${{ inputs.tool_config_path }}" ./.codacy/tools-configs/ |
No description provided.